package ch.ffhs.links_library.session;

import ch.ffhs.links_library.entities.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("folderHome")
public class FolderHome extends EntityHome<Folder> {

	private static final long serialVersionUID = -3705916441487616493L;

	public void setFolderIdFolder(Integer id) {
		setId(id);
	}

	public Integer getFolderIdFolder() {
		return (Integer) getId();
	}

	@Override
	protected Folder createInstance() {
		Folder folder = new Folder();
		return folder;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Folder getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<Link> getLinks() {
		return getInstance() == null ? null : new ArrayList<Link>(getInstance()
				.getLinks());
	}

}
